//
//  CellOfPush.m
//  HYHOME
//
//  Created by Mac on 16/1/27.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "CellOfPush.h"
#import "UIImageView+WebCache.h"
#import "ModelImage.h"
@implementation CellOfPush


- (void)dealloc{

    [self.labelOfPrice release];
    [self.imageV release];
    [super dealloc];


}


- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        
        self.imageV =  [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV];
        
        self.labelOfPrice = [[UILabel alloc]init];
        [self.imageV addSubview:self.labelOfPrice];
        
        
        [self.imageV release];
        [self.labelOfPrice release];
        
    }
    
    return self;
}



- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{


    
    self.imageV.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.frame.size.height - 35);
    
    self.labelOfPrice.frame = CGRectMake(0, self.frame.size.height - 55, self.frame.size.width, 20);
    
    self.labelOfPrice.textAlignment = NSTextAlignmentCenter;
    self.labelOfPrice.textColor = [UIColor whiteColor];


}
- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{

    return layoutAttributes;

}

- (void)layoutSubviews{

    [super layoutSubviews];
}

- (void)passModel:(ModelImage *)model{
    
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:[UIImage imageNamed:@"jz"]];
    
    self.labelOfPrice.text = [NSString stringWithFormat:@"$%@",model.price];
    


}

@end
